package com.lynn.salary.web.action;

import java.io.File;

import com.lynn.salary.service.IRolePermissionService;
import com.lynn.salary.service.ISysArgumentService;
import com.lynn.salary.util.ObjectFactory;

public class ImportAction extends BaseAction {
	private File salaryFile;
	private String salaryFileContentType;
	private String salaryFileFileName;
	private String remark;

	private ISysArgumentService sysArgumentService = (ISysArgumentService) ObjectFactory
			.getBean("sysArgumentService");
	private IRolePermissionService rolePermissionService = (IRolePermissionService) ObjectFactory
			.getBean("rolePermissionService");

	/*
	 * private IApplyService applyService = (IApplyService)
	 * ObjectFactory.getBean("applyService");
	 */

	public String importSalary() throws Exception {
		/*
		 * if(salaryFile != null) { String path = "d:/upload"; File nf = new
		 * File(path); if(!nf.exists())nf.mkdirs(); path +=
		 * "/"+salaryFileFileName; nf = new File(path);
		 * ToolMethod.copy(salaryFile,nf);
		 * 
		 * SystemFile sf = new SystemFile(); sf.setAlterTime(new Date());
		 * sf.setCreator(loginUser.getLoginUser().getId());
		 * sf.setFileName(salaryFileFileName);
		 * sf.setFileNumber(nf.getTotalSpace()+"");
		 * sf.setFileType(salaryFileContentType); sf.setNewTime(new Date());
		 * sf.setSavePath(path);
		 * sf.setWhoAlter(loginUser.getLoginUser().getId());
		 * 
		 * try { sf = sysArgumentService.saveSf(sf); } catch (Exception e) {
		 * e.printStackTrace(); throw e; }
		 * 
		 * //创建一条审批记录 交给总经理进行审批 List<Map<String, Object>> emps =
		 * rolePermissionService.findEmpContainRole("5"); //数据库中role为5的总经理角色 固定死
		 * for(Map<String,Object> m : emps) {
		 * 
		 * ExamAprv ea = new ExamAprv();
		 * ea.setApplyEmp(loginUser.getLoginUser().getId()); Date d = new
		 * Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月");
		 * ea.setApplyName("审批"+sdf.format(d)+"工资表"); ea.setAuditStartTime(d);
		 * ea.setAuditName((String) m.get("empId")); ea.setAuditType("工资表审批");
		 * ea.setAuditState("待审批"); ea.setRelateId(sf.getId());//关联文件
		 * ea.setRemark(remark); applyService.saveEa(ea); }
		 * 
		 * msg = "上传成功，等待审核!"; return "msg"; } return "importSalary";
		 */
		return null;
	}

	public File getSalaryFile() {
		return salaryFile;
	}

	public void setSalaryFile(File salaryFile) {
		this.salaryFile = salaryFile;
	}

	public String getSalaryFileContentType() {
		return salaryFileContentType;
	}

	public void setSalaryFileContentType(String salaryFileContentType) {
		this.salaryFileContentType = salaryFileContentType;
	}

	public String getSalaryFileFileName() {
		return salaryFileFileName;
	}

	public void setSalaryFileFileName(String salaryFileFileName) {
		this.salaryFileFileName = salaryFileFileName;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public ISysArgumentService getSysArgumentService() {
		return sysArgumentService;
	}

	public void setSysArgumentService(ISysArgumentService sysArgumentService) {
		this.sysArgumentService = sysArgumentService;
	}

	public IRolePermissionService getRolePermissionService() {
		return rolePermissionService;
	}

	public void setRolePermissionService(
			IRolePermissionService rolePermissionService) {
		this.rolePermissionService = rolePermissionService;
	}

}
